package com.olocat.cjx.nsims.dao

import com.olocat.cjx.nsims.pojo.personnel.Patient
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Modifying
import org.springframework.data.jpa.repository.Query
import javax.transaction.Transactional

interface PatientRepository : JpaRepository<Patient, String> {
    fun getByWard(ward: String): List<Patient>
    fun getByName(name: String): List<Patient>
    fun getPatientsByDepartment(department: Int): List<Patient>
    fun getPatientsByNurse(nurse:String):List<Patient>
    fun getPatientsByWard(number:String):List<Patient>
            @Transactional
            @Modifying
            @Query("update Patient p set p.adviceState=?2 where p.id=?1")

    fun setAdviceStateById(id: String, adviceState: Int)
}